package com.ruoyi.client.controller;

import com.ruoyi.client.mapper.ClassCategoriesMapper;
import com.ruoyi.client.pojo.vo.ClassCategoriesVo;
import com.ruoyi.client.pojo.vo.ClassDateVo;
import com.ruoyi.client.service.ClassCategoriesService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Anonymous//允许匿名访问
@CrossOrigin
@RestController
public class ClassCategoriesController {
    @Resource
    private ClassCategoriesService classCategoriesService;

    @GetMapping("/categories/list")
    public AjaxResult categories(){
        List<ClassCategoriesVo> classCategoriesVos=classCategoriesService.listCategories();
        ClassDateVo classDateVo=new ClassDateVo();
        classDateVo.setClassCategoriesVos(classCategoriesVos);
        return AjaxResult.success(classDateVo);
    }

}
